Image processing method for removing moving object and electronic device

ABSTRACT

An image processing method for removing a moving object includes an input step of inputting input images; a matching step of matching the input images according to corresponding positions; a determining step of determining a background image from the input images; a marking step of marking at least one moving object from at least one of the input images; and a replacing step of replacing a region, occupied by the moving object in at least one of the input images with a corresponding regional background in another input image.

BACKGROUND OF THE INVENTION

1. Field of Invention

The invention relates to an image processing method and an electronicdevice.

2. Related Art

With the progress of the technology, electronic devices (e.g., a digitalcamera, a camera mobile phone or any other tablet computer, notebookcomputer or the like with a camera lens or camera lenses) with camerafunctions are easily available. The user can easily record life detailsor scenic spots with photos obtained using the electronic device withthe camera function.

However, there may be accident conditions occurring duringphotographing. For example, a vehicle is driven into the composition ofthe user, or a flock of wild birds fly through the lens. Such movingobjects may accidentally appear on the photo, thereby deteriorating theaesthetic feeling of the photo. Therefore, if the moving objectdestroying the aesthetic feeling can be removed from the photo, the usermay obtain a better user experience.

SUMMARY OF THE INVENTION

In view of the foregoing, an objective of the invention is to provide animage processing method and an electronic device for removing a movingobject.

To achieve the above objective, the present invention discloses an imageprocessing method, comprising an input step of inputting multiple inputimages; a matching step of matching the input images according tocorresponding positions; a determining step of determining a backgroundimage from the input images; a marking step of marking at least onemoving object from at least one of the input images; and a replacingstep of replacing a region, occupied by the moving object in at leastone of the input images, with a corresponding regional background inanother one of the input images.

In one embodiment, the input images are sequentially shot images.

In one embodiment, the matching step comprises: searching at least onecharacteristic corner in a first input image of the input images;calculating an error amount between the characteristic corner and eachof corresponding candidate points in a second input image of the inputimages when the characteristic corner is found; finding a minimum errorfrom the error amounts; setting the characteristic corner, correspondingto the minimum error, and the corresponding candidate point as matchingcorners; calculating corner offsets according to coordinate values ofthe matching corners in the first input image and the second inputimage; and calculating an overall offset according to the corneroffsets.

In one embodiment, the determining step comprises: finely tuningcoordinates of the input images according to the overall offsets,respectively; obtaining a pixel color of a common correspondingcoordinate of the input images; and finding the pixel color with thehighest appearance possibility in each of the common correspondingcoordinates as the pixel color of each of the coordinates of thebackground image.

In one embodiment, the marking step comprises: comparing the pixelcolors of each of the coordinates of each of the input images after finetuning with the pixel colors of each of the coordinates of thebackground image one-by-one, and thus calculating a difference value;and marking the moving object according to each of the differencevalues.

In one embodiment, the marking step comprises: prompting a candidateobject to be marked by a user; and marking the candidate object as themoving object according to a user instruction.

In one embodiment, the replacing step comprises: finding the regionalbackground, corresponding to the moving object, from the another one ofthe input images; and replacing the moving object with the regionalbackground.

To achieve the above objective, the present invention also discloses anelectronic device, which comprises a storage unit and a processing unit.The storage unit stores input images. The processing unit matches theinput images according to corresponding positions, determines abackground image from the input images, marks at least one moving objectfrom at least one of the input images, and replaces a region, occupiedby the moving object in at least one of the input images, with acorresponding regional background in another one of the input images.

In one embodiment, the electronic device is a digital camera or a cameramobile phone.

In one embodiment, the input images are sequentially shot images.

In one embodiment, the processing unit matches the input imagesaccording to the corresponding positions by the following steps of:searching at least one characteristic corner in a first input image ofthe input images; calculating an error amount between the characteristiccorner and each of corresponding candidate points in a second inputimage of the input images when the characteristic corner is found;finding a minimum error from the error amounts; setting thecharacteristic corner, corresponding to the minimum error, and thecorresponding candidate point as matching corners; calculating corneroffsets according to coordinate values of the matching corners in thefirst input image and the second input image; and calculating an overalloffset according to the corner offsets.

In one embodiment, the processing unit determines the background imagefrom the input images by the following steps of finely tuningcoordinates of the input images according to the overall offsets,respectively; obtaining a pixel color of a common correspondingcoordinate of the input images; and finding the pixel color with thehighest appearance possibility in each of the common correspondingcoordinates as the pixel color of each of the coordinates of thebackground image.

In one embodiment, the processing unit marks the at least one movingobject from the at least one of the input images by the following stepsof: comparing the pixel colors of each of the coordinates of each of theinput images after fine tuning with the pixel colors of each of thecoordinates of the background image one-by-one, and thus calculating adifference value; and marking the moving object according to each of thedifference values.

In one embodiment, the electronic device further comprises a displayunit and an input unit. The display unit prompts a candidate object tobe marked by a user. The input unit is configured for inputting a userinstruction. The processing unit marks the candidate object as themoving object according to the user instruction.

In one embodiment, the processing unit replaces the region, occupied bythe moving object in the at least one of the input images, with thecorresponding regional background in the another one of the input imagesby the following steps of: finding the regional background,corresponding to the moving object, from the another one of the inputimages; and replacing the moving object with the regional background.

As mentioned above, according to the image processing method and theelectronic device of the invention for removing the moving object, theuser can remove the moving object, which destroys the aesthetic feeling,from the photo according to the invention so as to obtain the betteruser experience. In addition, the invention may be applied to variouselectronic devices, such as a personal computer, a digital camera, acamera function mobile phone and the like, and the operations thereofare simple and convenient, so that the user can save the input imagewithout the moving object or share the input image with friendsaccording to the invention, and the better user experience can beobtained.

BRIEF DESCRIPTION OF THE DRAWINGS

The invention will become more fully understood from the detaileddescription and accompanying drawings, which are given for illustrationonly, and thus are not limitative of the present invention, and wherein:

FIG. 1A is a flow chart showing an image processing method according toa preferred embodiment of the invention;

FIG. 1B is a flow chart showing a replacing step;

FIG. 2 is a schematic illustration showing matching of input imagesaccording to corresponding positions;

FIGS. 3A and 3B are schematic illustrations showing the image processingmethod for performing operations;

FIGS. 4A and 4B are schematic illustrations showing the image processingmethod for performing operations; and

FIG. 5 is a block diagram showing an electronic device according to apreferred embodiment of the invention.

DETAILED DESCRIPTION OF THE INVENTION

The present invention will be apparent from the following detaileddescription, which proceeds with reference to the accompanying drawings,wherein the same references relate to the same elements.

FIG. 1A is a flow chart showing an image processing method according toa preferred embodiment of the invention. The image processing method maybe applied to an electronic device, such as a portable electronic deviceincluding a digital camera, a camera mobile phone, a mobile phone, atablet computer, a notebook computer or the like; or a non-portableelectronic device including a personal computer, a digital photo frameor the like.

Referring to FIG. 1A, the image processing method includes steps S01 toS05.

The step S01 is an input step of inputting multiple input images.Specifically, the input images may be inputted by directly shot by thephotographing lens of the electronic device; or the input images may bestored in a storage unit of the electronic device, and the user providesa call event to call the images from the storage unit. The storage unitmay be a built-in element of the electronic device, such as a randommemory, an internal hard disk drive, a solid state disk drive, or thelike. Of course, the storage unit may also be an element, which is notbuilt in the electronic device, but is coupled to the electronic devicein a wired or wireless manner. For example, the storage unit may be anexternal hard disk drive, a universal serial bus (USB) mobile disk, oreach of various memory cards coupled to the electronic device in thewired manner. Alternatively, the storage unit may be a cloud hard diskdrive or a wireless universal serial bus (WUSB) mobile disk coupled tothe electronic device in the wireless manner. Preferably, the inputimages are sequentially shot images, such as a set of images shot by adigital camera in a burst mode.

The step S02 is a matching step of matching the input images accordingto corresponding positions. Taking the input images, which aresequentially shot images, as an example, the acquiring time intervalbetween the input images is extremely short (e.g., severalmilliseconds). So, the input images have similar background images. Inthis matching step, a portion or all of the input images are matchedaccording to the corresponding positions to find the correspondingrelationships between the input images.

Referring simultaneously to FIG. 2, the processes of the matching stepwill be further described in the following.

Referring simultaneously to FIG. 2, multiple input images of the videoare matched according to the corresponding positions, and the processesare described in the following.

First, the Harris corner detection approach is adopted to find at leastone characteristic corner in the first input image, wherein theoperation principle of the Harris corner detection approach is to judgewhether a pixel point is located in a plane, on an edge or at a cornerbased on the pixel point by checking the degrees of color level changesin all directions (e.g., up, down, left, right, upper right, upper left,lower right, lower left and the like) around the pixel point.Furthermore, the Harris corner detection approach calculates the colorlevel changes of pixel points in one Gaussian window or rectangularwindow to judge whether there is a corner present in the window.Generally speaking, there are multiple characteristic corners found.After all characteristic corners in the first input image are found,they are checked one by one.

Next, when one of the characteristic corners is checked, an individualerror amount between the characteristic corner and each of correspondingcandidate points in the second input image is calculated. Referringsimultaneously to FIG. 2, one of the characteristic corners will bedescribed as an example. A coordinate point (x_(I), y_(I)) correspondingto the characteristic corner u_(I)(x_(I), y_(I)) in the second inputimage is offset with different offsets to form multiple correspondingcandidate points. Next, a match box around the characteristic cornerU_(I) is opened, and match boxes, which have the same size and aredisposed around the corresponding candidate points, are also opened. Thecontent differences between the match box around the characteristiccorner u_(I) and the match boxes around the corresponding candidatepoints are calculated one by one, so that an error amount between thecharacteristic corner u_(I) and each of the corresponding candidatepoints in the second input image is obtained. The characteristic corneror each of the corresponding candidate points may be located inside thematch box, on the edge of the match box or at the corner of the matchbox. Furthermore, the error amount may be defined as follows:

${{E\left( {d_{x},d_{y}} \right)} = {\sum\limits_{x = {x_{l} - w_{x}}}^{x_{l} + w_{x}}{\sum\limits_{y = {y_{l} - w_{y}}}^{x_{l} + w_{y}}\left( {{I\left( {x,y} \right)} - {J\left( {{x + d_{x}},{y + d_{y}}} \right)}} \right)^{2}}}},$

where, d_(x) and d_(y) are x-axis and y-axis offset components,respectively, w_(x) and w_(y) are x-axis and y-axis dimensions of thematch box, respectively, I(x, y) and J(x, y) represent the contentfunctions of the first input image and the second input image at thecoordinate point (x, y), respectively, and the content function may berepresented by a color value or a gray scale value.

Then, a minimum error is found from the error amounts. Thecharacteristic corner, corresponding to the minimum error, and thecorresponding candidate point are set as matching corners. Specifically,the x-axis offset component and the y-axis offset componentcorresponding to the minimum error can be found according to thefollowing equation:

$\left( {d_{x},d_{y}} \right) = {\underset{d_{x},d_{y}}{argmin}\; {E\left( {d_{x},d_{y}} \right)}}$

The smaller error amount represents the higher matching degree betweenthe corresponding characteristic corner and the corresponding candidatepoint. So, the minimum error amount represents the highest matchingdegree between the corresponding characteristic corner and thecorresponding candidate point. In other words, the characteristic cornerand the corresponding candidate point can be paired by finding theminimum error from the error amounts, the corresponding candidate pointcorresponding to the specific characteristic corner can be found and setas the matching corner, and the corresponding candidate point is markedas u_(J)=(x_(J), y_(J)).

Finally, corner offsets are calculated according to the coordinatevalues of the matching corners in the first input image and the secondinput image. An overall offset is calculated according to the corneroffsets. Specifically, when the first input image and the second inputimage are not necessarily completely the same, especially when the firstinput image is different and offset from the second input image, the twosteps are to calculate the corner offsets between the correspondingmatching corners (the characteristic corner and the correspondingcandidate point). In this embodiment, the corner offsets are the x-axisoffset component and the y-axis offset component between thecharacteristic corner and the corresponding candidate pointcorresponding to the characteristic corner. In addition, all thecharacteristic corners u_(I)(x, y) in the first input image have thecorresponding candidate points u_(J)(x+d_(x), y+d_(y)), serving as thematching corners, in the second input image, and the correspondingx-axis offset component d_(x) and y-axis offset component d_(y).Accordingly, the overall offset between the first input image and thesecond input image is calculated according to the corner offsets. Forexample, the overall offset may be divided into the x-axis overalloffset and the y-axis overall offset. For the x-axis offset, thestatistical averages of the x-axis and y-axis offset components can becalculated according to the following equations, respectively:

$\begin{matrix}{{\Delta_{x} = {\frac{1}{N}{\sum\limits_{i = 1}^{N}d_{xi}}}},} & {\Delta_{y} = {\frac{1}{N}{\sum\limits_{i = 1}^{N}d_{yi}}}}\end{matrix}$

Thus, the first input image and the second input image can be matched,where N represents the number of the matching corners.

As a result, the relationship between the second input image and thefirst input image may approximate I(x, y)≈J(x+Δ_(x), y+Δ_(y)), whereI(x, y) and J(x, y) represent the content functions of the first inputimage and the second input image, respectively, at the coordinate point(x, y). That is, the content of the second input image at the coordinatepoint (x+Δ_(x), x+Δ_(y)) may approximate the content of the coordinatepoint (x, y) of the first input image. The content function mayrepresent the color value or the gray scale value of the point.

Referring still to FIG. 1A, the step S03 is a determining step. In thedetermining step, a background image is determined from the inputimages, the presence or absence and the located position of the movingobject in each input image can be judged according to the backgroundimage. The background image can be determined according to the codebookalgorithm. Furthermore, the determining step goes as follows.

First, the coordinate of each input image is finely tuned according toeach overall offset. For example, the coordinate of any input image canapproximate the coordinate of an input image, serving as a reference,plus the overall offset.

Then, the number of occurrences of each pixel color on the samecorresponding coordinate point of each input image is counted. Forexample, the same corresponding coordinate point in the n^(th) inputimage may be marked as F_(n)(x, y, R, G, B, t), where x and y representx-axis and y-axis coordinate values of the coordinate point,respectively; R, G and B represent red, green and blue values of thepixel color of the coordinate point, respectively; t represents thenumber of occurrences of the pixel color on the same correspondingcoordinate point of all input images. Illustrations will be made withreference to a practical example. In this example, there are ten inputimages, and the pixel color of a certain input image at the coordinatepoint (3, 4) is (R=100, G=101, B=102), and there are seven of the othernine input images having the pixel color of (R=100, G=101, B=102) at thesame corresponding coordinate point (3, 4), and the coordinatecharacteristic is marked as (3, 4, 100, 101, 102, 8).

Next, the pixel color with the highest number of occurrences among thesame corresponding coordinate points serves as the pixel color of eachcoordinate of the background image. For example, by establishing afollowing statistical matrix:

$\quad\begin{bmatrix}{P\left( {1,1} \right)} & {P\left( {1,2} \right)} & \ldots & {P\left( {1,w} \right)} \\{P\left( {2,1} \right)} & {P\left( {2,2} \right)} & \ldots & {P\left( {2,w} \right)} \\\vdots & \vdots & \ddots & \vdots \\{P\left( {h,1} \right)} & {P\left( {h,2} \right)} & \ldots & {P\left( {h,w} \right)}\end{bmatrix}$

where w and h represent the dimensions (the unit is a pixel) of thewidth and the height of the input image, respectively, the pixel colorwith the highest number of occurrences is found, one by one, for thecoordinate points and serves as the pixel color of the coordinate pointof the background image. This is represented by the following equations.

$i = {\underset{i}{argmax}\left\{ t_{i} \middle| {t_{i} \in F_{i}} \right\}}$I(x, y) = {(R_(i), G_(i), B_(i))|(R_(i), G_(i), B_(i)) ∈ F_(i)}

Another practical example will be described in the following. There areten input images, the number of occurrences of the pixel color (R=100,G=101, B=102) at the coordinate point (3, 4) of each input image isequal to 8, the number of occurrence of the pixel color (R=70, G=71,B=72) is equal to 1, and the number of occurrence of the pixel color(R=30, G=31, B=32) is equal to 1. That is, F1=(3, 4, 100, 101, 102, 8),F2=(3, 4, 70, 71, 72, 1), F3=(3, 4, 30, 31, 32, 1), P(3, 4)=(F1, F2,F3), and the pixel color with the highest appearance possibility is(R=100, G=101, B=102). So, the pixel color of the coordinate point (3,4) of the background image is set as (R=100, G=101, B=102).

The step S04 is a marking step. In the marking step, at least one movingobject is marked from at least one of the input images. The marking stepmay be classified into an automatically marking step and a manuallymarking step, wherein the processes of the automatically marking stepwill be described in the following.

First, a difference value is calculated by comparing the pixel color ofeach coordinate of each input image after fine tuning with the pixelcolor of each coordinate of the background image.

Next, the moving object is marked according to each difference value. Ina practical example, the coordinate point (3, 4) of an input image has(R=70, G=71, B=72) and the coordinate point (3, 4) of the backgroundimage has (R=100, G=101, B=102), and the coordinate point (3, 4) of theinput image is marked as one pixel of the moving object. That is, whenthe difference value is greater than a threshold value, it is marked asthe pixel of the moving object; and when the difference value is smallerthan a threshold value, it is not marked as the pixel of the movingobject. The expression is as follows:

${\Delta \; {I_{binalization}\left( {x,y} \right)}} = \left\{ \begin{matrix}0 & {{\Delta \; {I\left( {x,y} \right)}} \leq T} \\1 & {{\Delta \; {I\left( {x,y} \right)}} > T}\end{matrix} \right.$

where ΔI(x, y) represents the difference value between the pixel colorof the coordinate (x, y) of the input image after fine tuning and thepixel color of each coordinate of the background image; and T representsthe threshold value, which may have different values in differentembodiments and is not particularly restricted.

In addition, the marking step may also be a manually marking stepperformed through the user selection, and the processes thereof will bedescribed in the following.

First, a candidate object to be marked by the user is prompted. Themethod of prompting the candidate object may be provided through theautomatically marking step.

Then, the candidate moving object is marked as the moving objectaccording to a user instruction. When the user instruction identifiesthe candidate moving object as the moving object, the mark providing bythe automatically marking step is kept. When the user instruction doesnot identify the candidate moving object as the moving object, the markprovided by the automatically marking step is cancelled.

The step S05 is a replacing step of replacing a region, occupied by themoving object in the at least one of the input images, with acorresponding regional background in another input image. The specificprocesses of the replacing step are shown in FIG. 1B and will bedescribed in the following.

First, in step S051, the input images are searched to find thebackground corresponding to the moving object. For example, one of theinput images may be firstly selected as a reference image, on which themoving object has been marked. Then, the regional background of themoving object at corresponding positions of other input images is found.Next, in step S052, the region, occupied by the moving object in thereference image, is replaced by the corresponding regional backgroundfound from another input image. Next, in step S053, it is judged whetherall the moving objects have been replaced. If the judgment result is“No”, the process goes back to the step S051 to continue performing thereplacing process on other moving objects; otherwise, if the judgmentresult is “Yes”, then the processes are completed.

Please refer to FIGS. 3A, 3B, 4A and 4B, which are schematicillustrations showing the actual operations. FIGS. 3A and 3B show themethod of automatically marking the moving object, while FIGS. 4A and 4Bshow the method of manually marking the moving object. This actualoperation is described by taking a digital camera as an example.However, it is to be specified that the electronic devices, to which theinvention can be applied, are not restricted thereto.

As shown in FIG. 3A, the digital camera takes continuous photographingto input five input images. It is to be noted the input images have thesame character at different positions.

As shown in the upper and lower pictures of FIG. 3B, the upper pictureshows the input image, which has not been processed, while the lowerpicture shows the input image processed by the image processing methodof the invention. Comparing the two pictures, it is obtained that thecharacter has been removed from the processed input image, and thecorresponding background of the other input image is obtained forreplacement.

As shown in FIG. 4A, this embodiment similarly uses the sequentiallyshot photographs of FIG. 3A as the input images. In the upper picture,the digital camera prompts a candidate moving object T to the user. Whenthe user clicks this candidate moving object T, the digital cameraremoves the moving object by performing the image processing method ofthe invention, and the results are shown in the lower picture of FIG.4A, in which the character in the region of the candidate moving objectT has been removed.

Next, as shown in FIG. 4B, comparing the input image of the upperpicture (unprocessed) with the input image of the lower picture(processed), it is obtained that the character in the input image hasbeen removed, and the corresponding background is obtained from theother input image for replacement.

In addition, in some conditions where the image content is shot at aplace where many persons come and go, for example, if the input imagesdo not have the moving object, or the presence characteristic of themoving object is not obvious, the marking step does not automaticallymark the moving object. At this time, no moving object is marked, so thesubsequent replacing step will not be performed.

On the other hand, the marking step may also be configured such that theuser can manually mark the moving object so that the subsequentreplacing step can be performed in the state where the moving objectcannot be automatically marked.

In addition, the marking step may also be configured to prompt multiplecandidate moving objects, and the user can select one or more than oneobject to be removed from these candidate moving objects. After the userhas selected, the subsequent replacing step is performed.

FIG. 5 is a block diagram showing an electronic device 1 according to apreferred embodiment of the invention. Referring to FIG. 5, theelectronic device 1 includes a storage unit 11, a processing unit 12 andan image input unit 13. The processing unit 12 is coupled to the storageunit 11 and the image input unit 13.

The storage unit 11 is, for example, a volatile memory, a non-volatilememory, or a combination of the volatile and non-volatile memories. Theprocessing unit 12 is an operation element, such as a processor, amicrocontroller or the like, for executing the instruction sets. Theimage input unit 13 is, for example, a camera module.

The storage unit 11 stores multiple images, which may be inputted fromthe image input unit 13. The processing unit 12 matches the input imagesaccording to corresponding positions, determines a background image fromthe input images, marks at least one moving object from at least one ofthe input images, and replaces a region, occupied by a moving object inat least one of the input images, with a corresponding regionalbackground in another input image. Because the associated process flows,details and modifications are similar to the above-mentionedembodiments, detailed descriptions thereof will be omitted.

In addition, the electronic device 1 may further include a display unit14 and an input unit 15. The input unit 15 is, for example, a touchpanel, a keyboard or a mouse. The display unit 14 is, for example, adisplay or a monitor, such as display panel. The display unit 14 promptsa candidate object to be marked by the user. The user may input a userinstruction through the input unit 15. The processing unit 12 can markthe candidate moving object as the moving object according to the userinstruction. Because the associated process flows, details andmodifications are similar to the above-mentioned embodiments, thedetailed descriptions thereof will be omitted.

In summary, according to the image processing method and the electronicdevice of the invention for removing the moving object, the user canremove the moving object, which destroys the aesthetic feeling, from thephoto according to the invention so as to obtain the better userexperience. In addition, the invention may be applied to variouselectronic devices, such as a personal computer, a digital camera, acamera function mobile phone and the like, and the operations thereofare simple and convenient, so that the user can save the input imagewithout the moving object or share the input image with friendsaccording to the invention, and the better user experience can beobtained.

Although the invention has been described with reference to specificembodiments, this description is not meant to be construed in a limitingsense. Various modifications of the disclosed embodiments, as well asalternative embodiments, will be apparent to persons skilled in the art.It is, therefore, contemplated that the appended claims will cover allmodifications that fall within the true scope of the invention.

What is claimed is:
 1. An image processing method, comprising: an inputstep of inputting multiple input images; a matching step of matching theinput images according to corresponding positions; a determining step ofdetermining a background image from the input images; a marking step ofmarking at least one moving object from at least one of the inputimages; and a replacing step of replacing a region, occupied by themoving object in at least one of the input images, with a correspondingregional background in another one of the input images.
 2. The imageprocessing method according to claim 1, wherein the input images aresequentially shot images.
 3. The image processing method according toclaim 1, wherein the matching step comprises: searching at least onecharacteristic corner in a first input image of the input images;calculating an error amount between the characteristic corner and eachof corresponding candidate points in a second input image of the inputimages when the characteristic corner is found; finding a minimum errorfrom the error amounts; setting the characteristic corner, correspondingto the minimum error, and the corresponding candidate point as matchingcorners; calculating corner offsets according to coordinate values ofthe matching corners in the first input image and the second inputimage; and calculating an overall offset according to the corneroffsets.
 4. The image processing method according to claim 3, whereinthe determining step comprises: finely tuning coordinates of the inputimages according to the overall offsets, respectively; obtaining a pixelcolor of a common corresponding coordinate of the input images; andfinding the pixel color with the highest appearance possibility in eachof the common corresponding coordinates as the pixel color of each ofthe coordinates of the background image.
 5. The image processing methodaccording to claim 4, wherein the marking step comprises: comparing thepixel colors of each of the coordinates of each of the input imagesafter fine tuning with the pixel colors of each of the coordinates ofthe background image one-by-one, and thus calculating a differencevalue; and marking the moving object according to each of the differencevalues.
 6. The image processing method according to claim 1, wherein themarking step comprises: prompting a candidate object to be marked by auser; and marking the candidate object as the moving object according toa user instruction.
 7. The image processing method according to claim 1,wherein the replacing step comprises: finding the regional background,corresponding to the moving object, from the another one of the inputimages; and replacing the moving object with the regional background. 8.An electronic device, comprising: a storage unit storing input images;and a processing unit, which matches the input images according tocorresponding positions, determines a background image from the inputimages, marks at least one moving object from at least one of the inputimages, and replaces a region, occupied by the moving object in at leastone of the input images, with a corresponding regional background inanother one of the input images.
 9. The electronic device according toclaim 8, wherein the electronic device is a digital camera or a cameramobile phone.
 10. The electronic device according to claim 8, whereinthe input images are sequentially shot images.
 11. The electronic deviceaccording to claim 8, wherein the processing unit matches the inputimages according to the corresponding positions by the following stepsof: searching at least one characteristic corner in a first input imageof the input images; calculating an error amount between thecharacteristic corner and each of corresponding candidate points in asecond input image of the input images when the characteristic corner isfound; finding a minimum error from the error amounts; setting thecharacteristic corner, corresponding to the minimum error, and thecorresponding candidate point as matching corners; calculating corneroffsets according to coordinate values of the matching corners in thefirst input image and the second input image; and calculating an overalloffset according to the corner offsets.
 12. The electronic deviceaccording to claim 8, wherein the processing unit determines thebackground image from the input images by the following steps of: finelytuning coordinates of the input images according to the overall offsets,respectively; obtaining a pixel color of a common correspondingcoordinate of the input images; and finding the pixel color with thehighest appearance possibility in each of the common correspondingcoordinates as the pixel color of each of the coordinates of thebackground image.
 13. The electronic device according to claim 8,wherein the processing unit marks the at least one moving object fromthe at least one of the input images by the following steps of:comparing the pixel colors of each of the coordinates of each of theinput images after fine tuning with the pixel colors of each of thecoordinates of the background image one-by-one, and thus calculating adifference value; and marking the moving object according to each of thedifference values.
 14. The electronic device according to claim 8,further comprising: a display unit for prompting a candidate object tobe marked by a user; and an input unit configured for inputting a userinstruction; wherein the processing unit marks the candidate object asthe moving object according to the user instruction.
 15. The electronicdevice according to claim 8, wherein the processing unit replaces theregion, occupied by the moving object in the at least one of the inputimages, with the corresponding regional background in the another one ofthe input images by the following steps of: finding the regionalbackground, corresponding to the moving object, from the another one ofthe input images; and replacing the moving object with the regionalbackground.